﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace A2PongGame
{
    public class Input
    {
        public KeyboardState prevKeyBoardState { get; set; }
        public KeyboardState currentKeyBoardState { get; set; }

        public Input()
        {
            currentKeyBoardState = prevKeyBoardState = Keyboard.GetState();
        }
        public void UpdateInput()
        {
            prevKeyBoardState = currentKeyBoardState;
            currentKeyBoardState = Keyboard.GetState();
        }

        internal bool PlayerOneUp()
        {
            return currentKeyBoardState.IsKeyDown(Keys.Up) ;
        }

        internal bool PlayerOneDown()
        {
            return currentKeyBoardState.IsKeyDown(Keys.Down);
        }

        internal bool PlayerTwoUp()
        {
            return currentKeyBoardState.IsKeyDown(Keys.W) || GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).IsButtonDown(Buttons.DPadUp);
        }

        internal bool PlayerTwoDown()
        {
            return currentKeyBoardState.IsKeyDown(Keys.S) || GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).IsButtonDown(Buttons.DPadDown);
        }
    }
}
